<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        .stars input {
            display: none;
        }

        .stars label {
            /* float是重点 */
            float: right;
            color: gainsboro;
            font-size: 60px;
            margin: 0 5px;
            cursor: pointer;
            transition: 0.2s;
        }

        .stars label::before {
            content: "★";
        }

        .stars input:checked~label {
            color: blue;
        }

        .stars:not(:checked)>input:hover~label {
            color: blue;
        }
    </style>
</head>

<body>
    <div class="center">
        <div class="stars">
            <input type="radio" name="abc" id="five" value="5">
            <label for="five"></label>
            <input type="radio" name="abc" id="four" value="4">
            <label for="four"></label>
            <input type="radio" name="abc" id="three" value="3">
            <label for="three"></label>
            <input type="radio" name="abc" id="two" value="2">
            <label for="two"></label>
            <input type="radio" name="abc" id="one" value="1">
            <label for="one"></label>
        </div>
    </div>
</body>

</html>